<?php

use yii\helpers\Html;
use common\components\grid\GridView2015;
use common\models\BaseSite;

/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\SearchSysAdminUser */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '系统管理员';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="sys-admin-user-index">
    <?= GridView2015::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
    	'title' => $this->title,
    	'enableButton' => false,
    	'panel' => [
    		'before' => Html::a('添加', ['create'], ['class' => 'btn btn-success'])
    	],
        'columns' => [
            ['class' => 'common\components\grid\CheckboxColumn2015'],

            'id',
            //'user_name',
        	[
        		'class' => 'common\components\grid\EditableColumn2015',
        		'attribute' => 'user_name',	
    		],
            'email:email',
            //'password',
        	[
        	'attribute'=>'reg_time',
        	'format' => ['date', 'php:Y-m-d H:i:s'],
        	],
            'last_ip',
            [
            'attribute'=>'last_login_time',
            'format' => ['date', 'php:Y-m-d H:i:s'],
            ],
        	[	'class' => 'common\components\grid\DataColumn2015',
        		'filter' => f_p('site_list'),
        		'attribute' => 'site_id',
        		'value'=>function($model){ return $model->site_id ? '部分站点' : '所有站点';},
        	],

            [
            	'class' => 'common\components\grid\ActionColumn2015',
            	'template' => '{site}',
            	'buttons' => [
        			'site' => function($url, $model, $key) {
        				return Html::a('<span class="glyphicon glyphicon-search"></span>', f_url(['sys-admin-user/admin-user-site', 'admin_user_id' => $model->id]), [
        					'title' => '分配站点',
        				]);
        			}
            	]
            ],
        ],
    ]); ?>

</div>
